package br.utfpr.edu.business;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class Fabrica {
	 private static Fabrica me;
	 private EntityManagerFactory emf;
	 
	  private Fabrica() {
	        emf = Persistence.createEntityManagerFactory("Scet");
	  }

	  public static Fabrica getInstance() {
		  if (me == null) {
			  me = new Fabrica();
	       }
	     return me;
	 }
	  
	 public EntityManager getEntityManager() {
	        EntityManager toReturn = emf.createEntityManager();
	        toReturn.getTransaction().begin();
	        return toReturn;
	 }
}
